package com.hex.ds.hdtp.core.app.script.test.dto.response;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

import java.util.Arrays;
import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.script.test.dto.response
 * @ClassName ScriptDataTestTaskResponseDto
 * @Description: 带数据测试任务ResponseDto对象
 * @Author: wz.li
 * @Date 2023/8/1 15:21
 * @Version v2.0.2
 **/
@Data
public class ScriptDataTestTaskResponseDto {

    private String pkId;

    private String taskName;

    private String isDataAlignment;

    private String dataSyncType;

    private String dataSyncStartTime;

    private String dataSyncEndTime;

    private String status;

    private Integer testTotal;

    private Integer testSuccessCount;

    private Integer testFailCount;

    private String startTime;

    private String endTime;

    private String crtUser;

    private String crtUserName;

    private String crtTs;

    private String upUser;

    private String upUserName;

    private String upTs;

    private String testResult;

    private List<String> customTime;

    public List<String> getCustomTime() {
        if (StrUtil.isNotBlank(dataSyncStartTime) && StrUtil.isNotBlank(dataSyncEndTime)) {
            return Arrays.asList(dataSyncStartTime, dataSyncEndTime);
        }
        return customTime;
    }

    public String getTestResult() {
        return StrUtil.format("总数: {}, 成功个数: {}, 失败个数: {}", testTotal, testSuccessCount, testFailCount);
    }
}
